<template>
  <div v-if="ready" class="l-rblock">
    <l-code-mirror isScrollToBottom readOnly v-model="value" />
  </div>
</template>
<script>
export default {
  data() {
    return {
      value: "",
      ready: false,
      eventId: null,
    };
  },
  created() {},
  mounted() {
    this.eventId = this.lr_OnEvent("learun-im-system-ex-message", this.setText);
  },
  beforeDestroy() {
    if (this.eventId != null) {
      this.lr_OffEvent("learun-im-system-ex-message", this.eventId);
    }
  },
  methods: {
    init() {
      setTimeout(() => {
        this.ready = true;
      }, 100);
    },
    resetForm() {
      this.ready = false;
    },

    setText({ msg, dateTime, id }) {
      console.log(msg);
      msg = msg.replace('【99】',this.$t('空任务'));
      msg = msg.replace('【1】',this.$t('同步表结构'));
      msg = msg.replace('【2】',this.$t('同步数据'));
      msg = msg.replace('【3】',this.$t('创建账号'));
      msg = msg.replace('【4】',this.$t('同步菜单'));
      msg = msg.replace('【20】',this.$t('批量更新'));
      msg = msg.replace('【21】',this.$t('批量删除'));
      this.value += `${dateTime}-${msg}-${id}\r\n`;
    },
  },
};
</script>